<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html>
<head>
<title>PHP</title>
<link rel="stylesheet" href="/cfg/format.css" type="text/css">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="keywords" content="PHP, learn PHP, tutorial, programming language">
<meta name="description" content="In this part of the PHP tutorial, we describe the PHP language.">
<meta name="language" content="en">
<meta name="author" content="Jan Bodnar">
<meta name="distribution" content="global">

<script type="text/javascript" src="/lib/jquery.js"></script>
<script type="text/javascript" src="/lib/common.js"></script>

</head>

<body>

<div class="container">

<div id="wide_ad" class="ltow">
<script type="text/javascript"><!--
google_ad_client = "pub-9706709751191532";
/* 160x600, August 2011 */
google_ad_slot = "2484182563";
google_ad_width = 160;
google_ad_height = 600;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>

<div class="content">

<a href="/" title="Home">Home</a>&nbsp;
<a href="..">Contents</a>


<h1>PHP</h1>

<p>
In this part of the PHP tutorial, we will talk about the PHP programming language in general.
</p>


<h2>Goal</h2>

<p>
The goal of this tutorial is to get you started with the PHP programming language. The tutorial
covers the core of the PHP language. Variables, arrays, control structures and other core features. 
It does not cover web development, databases or other numerous topics. 
In this tutorial, we will cover PHP 5.
</p>

<div class="center">
<script type="text/javascript"><!--
google_ad_client = "ca-pub-9706709751191532";
/* top_horizontal */
google_ad_slot = "3327173442";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>


<h2>PHP</h2>

<p>
PHP is a scripting language designed for web development. It is used to produce dynamic
web pages. Currently, PHP is one of the most widely used programming languages.
Much of its syntax is borrowed from C, Java and Perl with a couple of unique PHP-specific features.
PHP can be embedded into HTML code and it generally runs on a web server. The web server
needs to be configured to process PHP code and create web page content from it. 
It can be deployed on most web servers and operating systems. PHP is a free software.
PHP was first created in 1995 and is actively developed since then. As of this writing, the
newest version is PHP 5.3.1.
</p>

<p>
PHP supports both object oriented and procedural programming styles. 
</p>

<p>
The official web site for the PHP programming language is 
<a href="http://php.net">php.net</a>
</p>


<h2>Programming languages</h2>

<p>
There are currently several widely used programming languages. 
The following list is based on the 
<a href="http://www.tiobe.com/tpci.htm">TIOBE</a> Programming 
Community Index. The numbers are from December 2009. 
Note that these figures are only illustrative. No one knows the exact numbers. 
</p>

<table width="400">
<tbody><tr>
<th>Position</th>
<th>Language</th>
<th>Ratings</th>
</tr>
<tr>
<td>1</td><td>Java</td><td>17%</td>
</tr>

<tr class="gray">
<td>2</td><td>C</td><td>16.3%</td>
</tr>
<tr>
<td>3</td><td>PHP</td><td>9.8%</td>
</tr>
<tr class="gray">
<td>4</td><td>C++</td><td>9.2%</td>
</tr>
<tr>
<td>5</td><td>Visual Basic</td><td>7.8%</td>
</tr>
<tr class="gray">
<td>6</td><td>C#</td><td>6.3%</td>
</tr>
<tr>
<td>7</td><td>Python</td><td>5.2%</td>
</tr>
<tr class="gray">
<td>8</td><td>Javascript</td><td>3.5%</td>
</tr>
<tr>
<td>9</td><td>PERL</td><td>2.69%</td>
</tr>
<tr class="gray">
<td>10</td><td>Ruby</td><td>2.65%</td>
</tr>

</tbody>
</table>

<p>
Java is the most widely used programming language. Java excels 
in creating portable mobile applications, 
programming various appliances and in creating enterprise applications. 
Every fourth application is programmed in C/C++. 
They are mainly used for creating operating systems and various 
desktop applications. C/C++ are the most widely used system 
programming languages. Most famous desktop applications were created in C++. 
May it be MS Office, Macromedia Flash, Adobe Photoshop or 3D Max. 
These two languages also dominate the game programming business. 
</p>

<p>
PHP dominates over the Web. While Java is used mainly by large organizations, 
PHP is used by smaller companies and individuals. 
</p>

<p>
Visual Basic represents the popularity of rapid application 
development and the dominance of Microsoft. 
</p>

<p>
The C# was planned to be the next big language. It should compete 
mainly with Java and C/C++ languages.
</p>

<p>
Python, PERL and Ruby are the most widely used scripting languages. 
They share many similarities. They are close competitors. 
</p>

<h2>PHP CLI</h2>

<p>
PHP CLI is a command line interpreter for the PHP language. It is useful for testing PHP
scripts from the shell. In this tutorial, we will be using the PHP command line interpreter. 
This way we will focus on the core of the PHP language. 
</p>

<p>
There is a php5-cli module which we have to install in order to run PHP 
on the command line. 
</p>


<pre class="code">
&lt;?php

echo "this is PHP language\n";

?&gt;
</pre>

<p>
Here we have a simple PHP script. 
</p>

<pre>
$ php simple.php
this is PHP language
</pre>

<p>
We execute the script. 
</p>


<h2>Interactive shell</h2>

<p>
Like Python or Ruby, PHP also has an interactive shell. It is 
useful to test small language constructs.
</p>

<pre class="code">
$ php -a
Interactive shell

php &gt; print PHP_OS;
Linux
</pre>

<p>
The PHP shell is invoked with the -a option of the php command. 
The shell uses the php &gt; prompt. 
</p>

<h2>References</h2>

<ul>
    <li><a href="http://www.php.net">php.net</a></li>
    <li><a href="http://www.wikipedia.org">wikipedia.org</a></li>
    <li>Gutmans, Bakken, Rethans; PHP 5 Power Programming</li>
</ul>


<p>
In this part of the PHP tutorial, we have introduced the PHP language. 
</p>

<div class="center"> 
<script type="text/javascript"><!--
google_ad_client = "pub-9706709751191532";
/* horizontal */
google_ad_slot = "1734478269";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script> 
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> 
</script> 
</div> 
<br> 


<div class="botNav, center">
<span class="botNavItem"><a href="/">Home</a></span> ‡ <span class="botNavItem"><a href="..">Contents</a></span> ‡ 
<span class="botNavItem"><a href="#">Top of Page</a></span>
</div>


<div class="footer">
<div class="signature">
<a href="/">ZetCode</a> last modified January 3, 2010  <span class="copyright">&copy; 2007 - 2013 Jan Bodnar</span>
</div>
</div>

</div> <!-- content -->

</div> <!-- container -->

</body>
</html>

